﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Ideas2Realize.Helpers
{
    public static class StringExtensions
    {

        public static int? ToNullableInt(this string str) {

            if (string.IsNullOrEmpty(str))
                return null;

            int number = 0; 

            if(int.TryParse(str, out number)) {
                return number; 
            }

            throw new Exception("Is not a number");
        }

    }
}
